<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>03demo</title>
    <script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"></script>
</head>
<body>
<div id="app">
    {{num}}
    <button v-on:click="increment">增加</button>
    <button v-on:click="decrement">减少</button>
</div>
<script type="text/javascript">
    var app = new Vue({
        el: "#app",
        data: {
            num: 0
        },
        methods: {
            decrement() {
                this.num--;
            },
            increment() {
                this.num++;
            }
        },
        created() {
            console.log("created hook")
        },
    });
</script>
</body>
</html>